package com.huang.app.demo3

import android.os.Bundle
import android.view.LayoutInflater
import androidx.recyclerview.widget.LinearLayoutManager
import com.alibaba.android.arouter.facade.annotation.Route
import com.blankj.utilcode.util.BarUtils
import com.chad.library.BR
import com.huang.app.R
import com.huang.app.databinding.ActivityDemo3Binding
import com.huang.app.demo3.vm.Demo3ViewModel
import com.huang.core.widget.recyclerview.decoration.LinearMarginDecoration
import com.huang.mvvm.activity.BaseActivity
import com.huang.router.router.AppRouter

@Route(path = AppRouter.DEMO3_ACTIVITY)
class Demo3Activity : BaseActivity<ActivityDemo3Binding, Demo3ViewModel>() {

    override fun getLayoutId(inflater: LayoutInflater, savedInstanceState: Bundle?): Int =
        R.layout.activity_demo3

    override fun getViewModelId(): Int = BR.viewModel

    override fun initView() {
        super.initView()
        BarUtils.addMarginTopEqualStatusBarHeight(binding.viewStatusBar)
        initRecyclerView()
    }

    /** 初始化RecyclerView */
    private fun initRecyclerView() {
        binding.recyclerView.layoutManager = LinearLayoutManager(this)
        binding.recyclerView.addItemDecoration(
            LinearMarginDecoration(
                LinearMarginDecoration.VERTICAL,
                1f
            )
        )
    }

}